<template>
	<view class="content">
		<!-- <view class="nav-style" :style="{'height':navHeight+'px','padding-top':statusBarHeight+'px'}" v-if="showNav" @click="back">
						<image src="../../static/back.png" mode=""></image>
						<view class="top-tl">
							文章标题
						</view>
		</view> -->

		<input type="text" placeholder="请扫描" class="scan_text" :value="scan_text">
		<view v-if="workOrder">
		<view class="adapter">
			<text class="adapterText">订单编号：</text><text>{{workOrder.pono}}</text><br/>
			<text class="adapterText">工作单号：</text><text>{{workOrder.wono}}</text><br/>
			<text class="adapterText">物料编号：</text><text>{{workOrder.itemno}}</text><br/>
			<text class="adapterText">物料名称：</text><text>{{workOrder.description}}</text><br/>
			<text class="adapterText">需要生产：</text><text>{{workOrder.reqqty}}</text><br/>
			<text class="adapterText">已完成数：</text><text>{{workOrder.finiqty}}</text><br/>
			<text class="adapterText">未完成数：</text><text>{{workOrder.unfiniqty}}</text><br/>
			<text class="adapterText">加工中心：</text><text></text><br/>
			<text class="adapterText">资   源：</text><text></text>
			
		</view>
		
		</view>
		<view>
			<button>绑定</button>
			<button>解绑</button>
		</view>
		<scan-code></scan-code> 
	</view>
</template>

<script>
	import scanCode from "@/components/scan-code/scan-code.vue";  
	export default {
		components: { scanCode },  
		data() {
			return {
				scan_text: '',
				wono: 'A0123456',
				workOrder: '',
			}
		},
		methods: {
			async sendPost(data){
				
				const res = await this.$myRequest({
					url: '/makerwit/wms/getWorkOrder',
					data: '{"wono": '+data+'}',
					method: 'POST'
				})
				console.log('=============================',res)
				console.log("----------",res.data.data.workOrder)
				this.workOrder=res.data.data.workOrder
				// console.log("----------",res.data.data[0].name.slice(0,1) == 'A')
				// for(let i = 0; i < res.data.data.length;i++){
				// 	if(res.data.data[i].name.slice(0,1) == 'A'){
				// 		this.activeArr = [...this.activeArr, res.data.data[i]]
				// 	}
				// }
				//this.activeArr = res.data.data
				
			},
		},
		onLoad() {
			//this.sendPost()
			//如果有这个工单号，则查询
			
		},
		onShow: function() {
		    var _this = this  
		    uni.$off('scancodedate') // 每次进来先 移除全局自定义事件监听器  
		    uni.$on('scancodedate',function(data){  
		        console.log('你想要的code：', data.code)  
				this.scan_text = data.code
				this.sendPost(data.code)
		    }.bind(this))  
		}
	}
</script>

<style lang="scss">
.adapter{
	.adapterText{
		width: 150px;
		color:#5677FC;
	}
}

.content{
	margin: 0 10px;
}

	.nav-style {
		position: fixed;
		top: 0;
		right: 0;
		left: 0;
		z-index: 1000;
		opacity: 0;
		background-color: #FFFFFF;
		display: flex;
		padding-left: 20rpx;
		align-items: center;
		//导航标题
		.top-tl {
			width: 400rpx;
			margin-left: 20rpx;
			font-size: 40rpx;
			color: #000;
			font-weight: 600;
			overflow: hidden;
			/*超出部分隐藏*/
			white-space: nowrap;
			/*不换行*/
			text-overflow: ellipsis;
			/*超出部分文字以...显示*/
		}
	}

</style>
